function sendPlanInToolBar(){
	var planIds = getSelections();
	if(!planIds){
		tip("请选择巡检任务");
		return;
	}
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgeForBatchRefuseMission",
		data : {
			"planIds" : planIds,
			"type" : "2",
			},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				sendPlan(planIds);
			}else{
				tip(data.msg);
			}
		}
	});
}
function refusePlanInToolBar(){
	var planIds = getSelections();
	if(!planIds){
		tip("请选择巡检任务");
		return;
	}

	$.ajax({
		url : "zyInspectionPlanController.do?doJudgeForBatchRefuseMission",
		data : {
			"planIds" : planIds,
			"type" : "1",
			},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				createwindow("拒绝任务","zyInspectionPlanController.do?goBatchRefuseMission&planIds="+planIds,500,300);
			}else{
				tip(data.msg);
			}
		}
	});
	
}
//派单
function assginEngineerInCol(id){
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgeForBatchRefuseMission",
		data : {
			"planIds" : id,
			"type" : "2",
			},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				sendPlan(id);
			}else{
				tip(data.msg);
			}
		}
	});
}

//转派
function assginEngineerInCols(id){
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgeForBatchRefuseMissions",
		data : {
			"planIds" : id
			},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				sendPlans(id);
			}else{
				tip(data.msg);
			}
		}
	});
}
function sendPlan(ids){
	createwindow("分派工程师","zyInspectionPlanController.do?goBatchAssignEngineer&planIds="+ids,500,200);
}
function sendPlans(ids){
    createwindow("转派工程师","zyInspectionPlanController.do?goBatchAssignEngineers&planIds="+ids,500,200);
}
function getSelections(){
	var datas = $("#zyTpInspectionPlanList").datagrid("getSelections");
	if(datas.length == 0){
		return false;
	}
	var planIdArr = new Array();
	$.each(datas,function(i,item){
		planIdArr.push(item.id);
	});
	return planIdArr.join(",");
}
function planDetials(filedName,url){
	addOneTab("巡检任务详情",url);
}

function exportIp(){
	var currPageRows = $("#zyTpInspectionPlanList").datagrid("getRows");
	var idsData = [];
	$(currPageRows).each(function(i,rowData){
		idsData.push(rowData.id);
	});
	if(idsData.length > 0){
		myDownload("zyInspectionPlanController.do?exportInspectionPlan","planIds="+idsData.join(","));
	}else{
		tip("当前页面没有数据可以导出");
	}
}